﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using ServiceManager.Services;

//namespace QuotationService.HistoryQuotation
//{
//    /// <summary>
//    /// 历史数据查询类
//    /// </summary>
//    internal class QuotationHistoryQuery
//    {
//        #region 交易日归档统计数据查询

//        /// <summary>
//        /// 查询所有交易日的归档统计数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <returns></returns>
//        public static List<ArchiverStatus> GetArchiverStatus(QuotationSource source)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ArchiverStatusCollection(source, mongoClient);
//            List<ArchiverStatus> retValues = collection.GetDatas();
//            MongoService.FreeOperatorClient();
//            return retValues;
//        }

//        /// <summary>
//        /// 查询指定交易日的归档统计数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static ArchiverStatus GetArchiverStatus(QuotationSource source, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ArchiverStatusCollection(source, mongoClient);

//            ArchiverStatus retValue = collection.GetDatas(tradeday);
//            MongoService.FreeOperatorClient();
//            return retValue;
//        }

//        /// <summary>
//        /// 取最新归档统计数据
//        /// </summary>
//        /// <param name="source"></param>
//        /// <returns></returns>
//        public static ArchiverStatus GetLatestArchiverStatus(QuotationSource source)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ArchiverStatusCollection(source, mongoClient);
//            var rtn = collection.GetLatestData();
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        #endregion

//        #region 现货查询
//        /// <summary>
//        /// 查询指定交易日的基本信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<StockBasicInfo> GetStockBasicInfos(StockQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockBasicInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetBasicInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }
//        /// <summary>
//        /// 查询指定交易日的行情信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<StockQuotationInfo> GetStockQuotationInfos(StockQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockQuotationInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetQuotInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 获取现货Tick数据
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="code"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<StockTickInfo> GetStockTickInfos(StockQuotationSource source, string code, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockTickInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetTicksByTradeDay(code, tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static StockMinuteData GetStockMinuteDatasByTradeDay(StockQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockMinuteDataArchiverCollection(source, mongoClient);

//            StockMinuteData retValue = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return retValue;
//        }

       
//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日</param>
//        /// <param name="endTradeday">结束交易日</param>
//        /// <param name="startIndex">返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<StockMinuteData> GetStockMinuteDatasByTradeDay(StockQuotationSource source, string code, uint startTradeday, uint endTradeday, out uint startIndex, out uint endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockMinuteDataArchiverCollection(source, mongoClient);

//            List<StockMinuteData> retValues = collection.GetDatasByTradeDay(code, startTradeday, endTradeday, out startIndex, out endIndex);
//            MongoService.FreeOperatorClient();
//            return retValues;
//        }


//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<StockMinuteData> GetStockMinuteDatasByIndex(StockQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockMinuteDataArchiverCollection(source, mongoClient);

//            List<StockMinuteData> retValues = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return retValues;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetStockMinuteDatasTotalCount(StockQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockMinuteDataArchiverCollection(source, mongoClient);

//            int retValue = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return retValue;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static StockDailyData GetStockDailyDatasByTradeDay(StockQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockDailyDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<StockDailyData> GetStockDailyDatasByTradeDay(StockQuotationSource source, string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<StockDailyData> GetStockDailyDatasByIndex(StockQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetStockDailyDatasTotalCount(StockQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetStockDailySequenceNoByTradeDay(StockQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockDailyDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetStockMinuteSequenceNoByTradeDay(StockQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new StockMinuteDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        #endregion

//        #region 期货查询

//        /// <summary>
//        /// 查询指定交易日的基本信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<FutureBasicInfo> GetFutureBasicInfos(FutureQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureBasicInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetBasicInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }
//        /// <summary>
//        /// 查询指定交易日的行情信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<FutureQuotationInfo> GetFutureQuotationInfos(FutureQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureQuotationInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetQuotInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 获取期货Tick数据
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="code"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<FutureTickInfo> GetFutureTickInfos(FutureQuotationSource source, string code, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureTickInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetTicksByTradeDay(code, tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }


//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static FutureMinuteData GetFutureMinuteDatasByTradeDay(FutureQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<FutureMinuteData> GetFutureMinuteDatasByTradeDay(FutureQuotationSource source, string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<FutureMinuteData> GetFutureMinuteDatasByIndex(FutureQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetFutureMinuteDatasTotalCount(FutureQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static FutureDailyData GetFutureDailyDatasByTradeDay(FutureQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<FutureDailyData> GetFutureDailyDatasByTradeDay(FutureQuotationSource source, string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<FutureDailyData> GetFutureDailyDatasByIndex(FutureQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取日线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetFutureDailyDatasTotalCount(FutureQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetFutureDailySequenceNoByTradeDay(FutureQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureDailyDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetFutureMinuteSequenceNoByTradeDay(FutureQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new FutureMinuteDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        #endregion

//        #region 组合查询


//        /// <summary>
//        /// 查询指定交易日的基本信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<ComboBasicInfo> GetComboBasicInfos(ComboQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ComboBasicInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetBasicInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 查询指定交易日的行情信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<ComboQuotationInfo> GetComboQuotationInfos(ComboQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ComboQuotationInfoArchiverCollection(source, mongoClient);
//            List<ComboQuotationInfo> rtn = collection.GetQuotInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 获取组合Tick数据
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="code"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<ComboTickInfo> GetComboTickInfos(ComboQuotationSource source, string code, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new ComboTickInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetTicksByTradeDay(code, tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }



//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static ComboMinuteData GetComboMinuteDatasByTradeDay(string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboMinuteDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<ComboMinuteData> GetComboMinuteDatasByTradeDay(string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboMinuteDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<ComboMinuteData> GetComboMinuteDatasByIndex(string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboMinuteDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetComboMinuteDatasTotalCount(string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboMinuteDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static ComboDailyData GetComboDailyDatasByTradeDay(string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboDailyDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<ComboDailyData> GetComboDailyDatasByTradeDay(string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboDailyDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<ComboDailyData> GetComboDailyDatasByIndex(string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboDailyDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetComboDailyDatasTotalCount(string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboDailyDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetComboDailySequenceNoByTradeDay(string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboDailyDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetComboMinuteSequenceNoByTradeDay(string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(ComboQuotationSource.Combo.ToString());
//            var collection = new ComboMinuteDataArchiverCollection(ComboQuotationSource.Combo, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        #endregion

//        #region 期权查询


//        /// <summary>
//        /// 查询指定交易日的基本信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<OptionBasicInfo> GetOptionBasicInfos(OptionQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionBasicInfoArchiverCollection(source, mongoClient);
//            List<OptionBasicInfo> rtn = collection.GetBasicInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }
//        /// <summary>
//        /// 查询指定交易日的行情信息集合
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<OptionQuotationInfo> GetOptionQuotationInfos(OptionQuotationSource source, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionQuotationInfoArchiverCollection(source, mongoClient);
//            List<OptionQuotationInfo> rtn = collection.GetQuotInfosByTradeDay(tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }

//        /// <summary>
//        /// 获取期权Tick数据
//        /// </summary>
//        /// <param name="source"></param>
//        /// <param name="code"></param>
//        /// <param name="tradeDay"></param>
//        /// <returns></returns>
//        public static List<OptionTickInfo> GetOptionTickInfos(OptionQuotationSource source, string code, uint tradeDay)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionTickInfoArchiverCollection(source, mongoClient);
//            var rtn = collection.GetTicksByTradeDay(code, tradeDay);
//            MongoService.FreeOperatorClient();
//            return rtn;
//        }
//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static OptionMinuteData GetOptionMinuteDatasByTradeDay(OptionQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<OptionMinuteData> GetOptionMinuteDatasByTradeDay(OptionQuotationSource source, string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询分线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<OptionMinuteData> GetOptionMinuteDatasByIndex(OptionQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取分线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetOptionMinuteDatasTotalCount(OptionQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionMinuteDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static OptionDailyData GetOptionDailyDatasByTradeDay(OptionQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startTradeday">起始交易日, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endTradeday">结束交易日, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<OptionDailyData> GetOptionDailyDatasByTradeDay(OptionQuotationSource source, string code, ref uint startTradeday, ref uint endTradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByTradeDay(code, ref startTradeday, ref endTradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询日线数据
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="startIndex">起始序号, 查询成功是，返回结果中第一条记录在全部数据中的序号(按日编序号)</param>
//        /// <param name="endIndex">结束序号, 查询成功是，返回结果中最后一条记录在全部数据中的序号(按日编序号)</param>
//        /// <returns></returns>
//        public static List<OptionDailyData> GetOptionDailyDatasByIndex(OptionQuotationSource source, string code, ref int startIndex, ref int endIndex)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetDatasByIndex(code, ref startIndex, ref endIndex);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 取日线的总数
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <returns></returns>
//        public static int GetOptionDailyDatasTotalCount(OptionQuotationSource source, string code)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionDailyDataArchiverCollection(source, mongoClient);

//            var ret = collection.GetTotalCount(code);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetOptionDailySequenceNoByTradeDay(OptionQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionDailyDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        /// <summary>
//        /// 查询交易日序号
//        /// </summary>
//        /// <param name="source">行情源</param>
//        /// <param name="code">证券代码</param>
//        /// <param name="tradeday">交易日</param>
//        /// <returns></returns>
//        public static int GetOptionMinuteSequenceNoByTradeDay(OptionQuotationSource source, string code, uint tradeday)
//        {
//            var mongoClient = MongoService.GetOperatorClient(source.ToString());
//            var collection = new OptionMinuteDataArchiverCollection(source, mongoClient);
//            var ret = collection.GetSequenceNoOfTradeday(code, tradeday);
//            MongoService.FreeOperatorClient();
//            return ret;
//        }

//        #endregion

//    }
//}
